﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using QLTV_Public;

namespace QLTV_Data
{
  public  class NhaXuatBan_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
      public DataTable LayDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_NhaXuatBan");
      }
      public int insert_NhaXuatBan(NhaXuatBan_Public tenNXB,NhaXuatBan_Public diaChi,NhaXuatBan_Public sodt,NhaXuatBan_Public fax,NhaXuatBan_Public email,NhaXuatBan_Public ghiChu)
      {
          int Nparameter = 6;
          string[]name=new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@TenNhaXuatBan";
          value[0] = tenNXB.TenNhaXuatBan;
          name[1] = "@DiaChi";
          value[1] = diaChi.DiaChi;
          name[2] = "@SoDienThoai";
          value[2] = sodt.SoDienThoai;
          name[3] = "@Fax";
          value[3] = fax.Fax;
          name[4] = "@Email";
          value[4] = email.Email;
          name[5] = "@GhiChu";
          value[5] = ghiChu.GhiChu;
          return kn.update("Insert_NXB", name, value, Nparameter);
      }
      public int update_NhaXuatBan(NhaXuatBan_Public maNhaXB, NhaXuatBan_Public tenNXB, NhaXuatBan_Public diaChi, NhaXuatBan_Public sodt, NhaXuatBan_Public fax, NhaXuatBan_Public email, NhaXuatBan_Public ghiChu)
      {
          int Nparameter = 7;
          string[] name = new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@MaNhaXuatBan";
          value[0] = maNhaXB.MaNhaXuatBan;
          name[1] = "@TenNhaXuatBan";
          value[1] = tenNXB.TenNhaXuatBan;
          name[2] = "@DiaChi";
          value[2] = diaChi.DiaChi;
          name[3] = "@SoDienThoai";
          value[3] = sodt.SoDienThoai;
          name[4] = "@Fax";
          value[4] = fax.Fax;
          name[5] = "@Email";
          value[5] = email.Email;
          name[6] = "@GhiChu";
          value[6] = ghiChu.GhiChu;
          return kn.update("Update_NXB", name, value, Nparameter);
      }
      public int delete_NhaXuatBan(NhaXuatBan_Public maNhaXuatBan)
      {
          int Nparameter=1;
          string []name=new string[Nparameter];
          object []value=new object[Nparameter];
          name[0] = "@MaNhaXuatBan";
          value[0] = maNhaXuatBan.MaNhaXuatBan;
          return kn.update("Delete_NXB",name,value,Nparameter);
      }
    }
}
